package com.dzu.medium;

/**
 * @author ZhaoDong
 * @date 2022/11/17 16:04
 * @description 172. 阶乘后的零
 */
public class Test172 {

    public static void main(String[] args) {
        System.out.println("trailingZeroes(3) = " + trailingZeroes(9));
    }

    public static int trailingZeroes(int n) {
        int ans = 0;
        while (n != 0) {
            n /= 5;
            ans += n;
        }
        return ans;
    }

    public static int trailingZeroes2(int n) {
        return n == 0 ? 0 : n / 5 + trailingZeroes(n / 5);
    }



}
